home *** CD-ROM | disk | FTP | other *** search
/ Introduction to 3D Game …ogramming with DirectX 12 / Introduction-to-3D-Game-Programming-with-DirectX-12.ISO / Code.Textures / Chapter 13 The Compute Shader / VecAdd / Shaders / VecAdd.hlsl
Encoding:
Text File  |  2016-03-02  |  400 b   |  19 lines

  1.  
  2. struct Data
  3. {
  4.     float3 v1;
  5.     float2 v2;
  6. };
  7.  
  8. StructuredBuffer<Data> gInputA : register(t0);
  9. StructuredBuffer<Data> gInputB : register(t1);
  10. RWStructuredBuffer<Data> gOutput : register(u0);
  11.  
  12.  
  13. [numthreads(32, 1, 1)]
  14. void CS(int3 dtid : SV_DispatchThreadID)
  15. {
  16.     gOutput[dtid.x].v1 = gInputA[dtid.x].v1 + gInputB[dtid.x].v1;
  17.     gOutput[dtid.x].v2 = gInputA[dtid.x].v2 + gInputB[dtid.x].v2;
  18. }
  19.